package com.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.common.BaseResponse;
import com.domain.dto.UserInfo;
import com.domain.entity.ApplyFriend;
import com.domain.entity.User;
import com.domain.request.ApplyFriendRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
* @author Administrator
* @description 针对表【users】的数据库操作Service
* @createDate 2024-05-17 10:58:25
*/
public interface UsersService extends IService<User> {

    User getLoginUser(HttpServletRequest request);

    /**
     * 用户登录
     * @param userAccount
     * @param userPassword
     * @param request
     * @return
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 用户脱敏
     *
     * @param originUser
     * @return
     */
    User getSafetyUser(User originUser);

    int updateUser(User user, User loginUser);

    boolean isAdmin(User loginUser);

    boolean isAdmin(HttpServletRequest request);

    /**
     * 登出
     * @param request
     * @return
     */
    int userLogout(HttpServletRequest request);

    /**
     * 根据多个标签获取用户
     *
     * @param tags
     * @return
     */
    BaseResponse<ArrayList<UserInfo>> getUserByTag(ArrayList<String> tags) throws ExecutionException, InterruptedException;

    /**
     * 用户注册
     * @param userAccount
     * @param userPassword
     * @param checkPassword
     * @return
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 匹配用户
     * @param num
     * @param loginUser
     * @return
     */
    List<User> matchUsers(long num, User loginUser);

    /**
     * 好友申请
     *
     * @param applyFriendRequest
     * @param id
     * @return
     */
    BaseResponse<Boolean> applyFriend(ApplyFriendRequest applyFriendRequest, Long id);

    /**
     * 获取id用户的好友申请列表
     * @param id
     * @return
     */
    List<ApplyFriend> getApplyFriendList(Long id);
}
